package com.disgnpattern.learn.chapter1;

import java.util.Scanner;

/**
 * @author dxy
 * @version 1.0
 * @date 2021/10/21 14:51
 * @decripton 测试方法
 */
public class OperationTest {
    public static void main(String[] args) {
        try {
            System.out.println("请输入数字A:");
            Scanner scanner = new Scanner(System.in);
            Double numberA = scanner.nextDouble();

            System.out.println("请输入运算符号:");
            String operationInput = scanner.next();

            System.out.println("请输入数字B:");
            Double numberB = scanner.nextDouble();


            AbstractOperation operation = OperationFactory.getOperation(operationInput);
            operation.setNumberA(numberA);
            operation.setNumberB(numberB);
            System.out.println("结果:" + operation.getResult());


        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
